package com.example.eos.bean;

import com.alibaba.fastjson.annotation.JSONField;
import com.example.eos.service.GlobalService;
import com.example.eos.tool.GlobalParam;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.util.Date;
import java.util.List;

/**
 * 标签信息
 */
public class Label {
    private String labelid;

    @NotNull(message = "标签名不能为空")
    @Length(min = 1, max = 10, message = "标签格式错误")
    private String labelname;

    private Integer usednum;

    @JSONField(format="yyyy-MM-dd HH:mm:ss")
    private Date creattime;

    private Boolean exist;

    public Label(){}

    public Label(String labelname){
        this.labelid = GlobalParam.getUUID();
        this.labelname = labelname;
        this.usednum = 0;
        this.creattime = GlobalParam.getTime();
        this.exist = true;
    }

    @Override
    public String toString() {
        return "Label{" +
                "labelid='" + labelid + '\'' +
                ", labelname='" + labelname + '\'' +
                ", usednum=" + usednum +
                ", creattime=" + creattime +
                ", exist=" + exist +
                '}';
    }

    public String getLabelid() {
        return labelid;
    }

    public void setLabelid(String labelid) {
        this.labelid = labelid == null ? null : labelid.trim();
    }

    public String getLabelname() {
        return labelname;
    }

    public void setLabelname(String labelname) {
        this.labelname = labelname == null ? null : labelname.trim();
    }

    public Integer getUsednum() {
        return usednum;
    }

    public void setUsednum(Integer usednum) {
        this.usednum = usednum;
    }

    public Date getCreattime() {
        return creattime;
    }

    public void setCreattime(Date creattime) {
        this.creattime = creattime;
    }

    public Boolean getExist() {
        return exist;
    }

    public void setExist(Boolean exist) {
        this.exist = exist;
    }
}